package com.jie.base.controller;

import com.jie.base.service.CityService;
import com.jie.common.result.Result;
import com.jie.model.vo.base.CityVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author jie
 * @version 1.0 2025-02-15
 */
@RestController
@RequestMapping("/city")
@RequiredArgsConstructor
public class CityController {

    private final CityService cityService;

    @GetMapping("/all")
    public Result<List<CityVO>> getAllCity() {
        List<CityVO> cities = cityService.getAllCity();
        return Result.success(cities);
    }

    /**
     * 获取热门城市信息
     * @return
     */
    @GetMapping("/hot")
    public Result<List<CityVO>> getHotCity() {
        List<CityVO> hotCity = cityService.getHotCity();
        return Result.success(hotCity);
    }

    /**
     * 最近访问的城市
     * @return
     */
    @GetMapping("/recent")
    public Result<List<CityVO>> getRecentCity() {
        List<CityVO> cityVOS = cityService.getRecentCity();
        return Result.success(cityVOS);
    }

}
